Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add utilities for benchmarking different code versions #65

Merged
merged 107 commits into from
Oct 29, 2024

Conversation

sbaldu
Copy link
Collaborator

@sbaldu sbaldu commented Oct 28, 2024

This PR reworks the profiling scripts and provides a script for benchmarking execution time as a function of dataset size.
It also provides a python script for fetching specific versions of CLUEstering for comparison.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pylintpython3 (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

import sys

def parse_args() -> tuple:
path = sys.argv[2]

Check warning

Code scanning / Prospector (reported by Codacy)

Unused variable 'path' (unused-variable) Warning test

Unused variable 'path' (unused-variable)

return (flags, values)

if sys.argv[1] == "-h" or sys.argv[1] == "--help" or len(sys.argv) < 3:

Check warning

Code scanning / Prospector (reported by Codacy)

expected 2 blank lines after class or function definition, found 1 (E305) Warning test

expected 2 blank lines after class or function definition, found 1 (E305)
# Checkout the repo
os.system("mkdir -p " + clue_version)

clone = subprocess.run(["git",

Check warning

Code scanning / Prospector (reported by Codacy)

Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check) Warning test

Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check)
print("Compiling the Debug version of the library")
os.chdir(f"{clue_version}/Debug")
# Compile the debug version
compile_debug = subprocess.run(["cmake",

Check warning

Code scanning / Prospector (reported by Codacy)

Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check) Warning test

Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check)
print(f"Error: {compile_debug.stderr}")
print("Failed to compile the debug version of the project")
sys.exit(1)
compile_debug = subprocess.run(["cmake",

Check warning

Code scanning / Prospector (reported by Codacy)

Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check) Warning test

Using subprocess.run without explicitly set check is not recommended. (subprocess-run-check)
@@ -0,0 +1,49 @@

import matplotlib.pyplot as plt

Check warning

Code scanning / Prospector (reported by Codacy)

Unable to import 'matplotlib.pyplot' (import-error) Warning

Unable to import 'matplotlib.pyplot' (import-error)
@@ -0,0 +1,49 @@

import matplotlib.pyplot as plt
import numpy as np

Check warning

Code scanning / Prospector (reported by Codacy)

Unable to import 'numpy' (import-error) Warning

Unable to import 'numpy' (import-error)

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

Check warning

Code scanning / Prospector (reported by Codacy)

Unable to import 'pandas' (import-error) Warning

Unable to import 'pandas' (import-error)
import pandas as pd


def generate_data(n_points: int,

Check warning

Code scanning / Prospector (reported by Codacy)

Too many arguments (6/5) (too-many-arguments) Warning

Too many arguments (6/5) (too-many-arguments)
size=(points_per_cluster, n_dim)))

# concatenate clusters data
data = np.concatenate([cl for cl in clusters])

Check warning

Code scanning / Prospector (reported by Codacy)

Unnecessary use of a comprehension (unnecessary-comprehension) Warning

Unnecessary use of a comprehension (unnecessary-comprehension)
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pylint (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

#!/bin/python3

import os
import subprocess

Check notice

Code scanning / Bandit (reported by Codacy)

Consider possible security implications associated with subprocess module. Note test

Consider possible security implications associated with subprocess module.

repo_url = f"https://github.com/{fork}/CLUEstering.git"
# Checkout the repo
os.system("mkdir -p " + clue_version)

Check notice

Code scanning / Bandit (reported by Codacy)

Starting a process with a shell, possible injection detected, security issue. Note test

Starting a process with a shell, possible injection detected, security issue.
# Checkout the repo
os.system("mkdir -p " + clue_version)

clone = subprocess.run(["git",

Check notice

Code scanning / Bandit (reported by Codacy)

Starting a process with a partial executable path Note test

Starting a process with a partial executable path
# Checkout the repo
os.system("mkdir -p " + clue_version)

clone = subprocess.run(["git",

Check notice

Code scanning / Bandit (reported by Codacy)

subprocess call - check for execution of untrusted input. Note test

subprocess call - check for execution of untrusted input.
print((f"Failed to clone the repo {repo_url}. Check that the insersted repository,"
"commit or branch are correct"))
sys.exit(1)
os.system("cp -r " +

Check notice

Code scanning / Bandit (reported by Codacy)

Starting a process with a shell, possible injection detected, security issue. Note test

Starting a process with a shell, possible injection detected, security issue.
print("Compiling the Release version of the library")
os.chdir("../Release")
# Compile the release version
compile_release = subprocess.run(["cmake",

Check notice

Code scanning / Bandit (reported by Codacy)

Starting a process with a partial executable path Note test

Starting a process with a partial executable path
print(f"Error: {compile_release.stderr}")
print("Failed to compile the release version of the project")
sys.exit(1)
compile_release = subprocess.run(["cmake",

Check notice

Code scanning / Bandit (reported by Codacy)

subprocess call - check for execution of untrusted input. Note test

subprocess call - check for execution of untrusted input.
print(f"Error: {compile_release.stderr}")
print("Failed to compile the release version of the project")
sys.exit(1)
compile_release = subprocess.run(["cmake",

Check notice

Code scanning / Bandit (reported by Codacy)

Starting a process with a partial executable path Note test

Starting a process with a partial executable path
"2"],
capture_output=True,
text=True)
compile_release = subprocess.run(["cmake",

Check notice

Code scanning / Bandit (reported by Codacy)

Starting a process with a partial executable path Note test

Starting a process with a partial executable path
"2"],
capture_output=True,
text=True)
compile_release = subprocess.run(["cmake",

Check notice

Code scanning / Bandit (reported by Codacy)

subprocess call - check for execution of untrusted input. Note test

subprocess call - check for execution of untrusted input.
@@ -0,0 +1,3 @@
#

Check warning

Code scanning / Shellcheck (reported by Codacy)

Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. Warning test

Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
@@ -0,0 +1,3 @@
#

perf stat -B -e cache-references,cache-misses,cycles,instructions,branches $1

Check notice

Code scanning / Shellcheck (reported by Codacy)

Double quote to prevent globbing and word splitting. Note test

Double quote to prevent globbing and word splitting.
@sbaldu sbaldu merged commit d3d93a1 into cms-patatrack:main Oct 29, 2024
19 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant